taBackup v1.02
a simple backup program
taBackup is a backup program that allows you to define file sets and to write small scripts for making backups to CF-disks or for synchronising two folders. I started writing this program two years ago, because I didn't find a similar program. Today the situation has changed a little bit, but I think the program is still useful.
Use it at your own risk. Read the "Known Problems & Limitations" section. I've used this program for quite a while now and it seems to work quite well, but it's always possible that some newer changes have some unexpected side effects. As the main task of this program is copying files, some malfunction could possibly involve accidental deletion of your data. This hasn't happened so far, but it is possible. In any case, I cannot be made responsible for any damages, data loss etc. caused by this program.
Copyright (C) 1999-2000, Thomas Link <t.link@gmx.at>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Download
GNU-License:
http://www.gnu.org/copyleft/gpl.html
Homepage:
http://webplanet.lion.cc/jupiter/320094/taBackup.htm
SIS-file:
http://webplanet.lion.cc/jupiter/320094/taBackup.zip
Sources:
http://webplanet.lion.cc/jupiter/320094/taBackup-src.zip
Installation
The following should be taken into account before installation:
- Emulator: For usage with the emulator you will have to download the proper versions of the included OPX files from Symbian's (www.symbian.com), and Neuon's (www.neuon.com) web sites. Using the ARM versions of these OPX files in conjunction with the emulator will result in an error.
- When removing this program, some file on drive C: are not deleted.
- In the unlikely case that you upgrade from version 1.0, the configuration file (c:\System\Apps\taBackup\config.txt) will be deleted. Make a backup first. The same is true for the catalog file, but as the v1.0 format is not compatible with the new one, you should simply accept the inevitable.
Settings
In order to use this program you will have to define file sets or scripts. Therefore, you have to edit the configuration file. Press ctrl+f, choose "Config" from the button bar, or "Configure filesets" from the menu. See the section about the configuration file to find out how to define file sets.
On the main screen, tap onto the text area or press the enter key to bring up the main dialog. In case you just want to play around a little bit, choose "Preview" from the "Action" menu.
Action: modes of operation
- Ask: Query user, this might be useful if you only want to backup specific files that could not be defined otherwise
- Run: Log actions page by page
- Run faster: Don't halt at page break
- Preview: Show what would be done.
Mode: modes of copying files (A to B)
- Backup: copy if A is newer than B or if B does not exist
- Copy: copy A to B; ask for confirmation if B is newer
- Copy if changed: copy if A and B are different or if B does not exist
- Copy if newer: copy A to B if A is newer than B
- Synchronise: for all files in A, choose the file more up to date, or copy if B does not exist
- Synchronise-Bi: also copy files not present in directory A
- Update: for all files in A and B, choose the file more up to date
Backup Set: select a file set or script as defined in the configuration file
Pattern: restrict a backup set using OPL pattern matching:
? matches any single character
* matches any group of characters.
Empty folders: to create or not to create, this is the question. If you wish to reconstruct the directory structure, select "create"
Keep versions: number of older versions you want to keep. As long as you don't have a really large CF-disk, change its value only for specific scripts using the set-command. If you reduce the number of versions you want to keep, superfluous files are deleted. This behaviour can be changed by setting the appropriate option -- see the "Options" section.
Log level: Determines how detailed the log should be. In case the program functions as expected, choose level 2 or 3.
Catalog, Image
In the catalog any file copying is registered. You can review this catalog and restore files from the backup disk.
An "image" is basically the same as a catalog, with the exception that only the files last encountered are registered. The image is stored in the destination directory.
Both features have to be enabled by selecting the appropriate option -- "Build Catalog" or "Build Image" -- in the preference dialog.
The find command supports simple pattern matching using the "*"-wildcard.
- Tip:
- Cross-check: use this option in conjunction with "Build catalogs" in order to check for anomalies.
Configuration file
- define your own file sets and scripts in "C:\System\Apps\taBackup\config.txt", a plain text
- the configuration file consists of several sections, each ending with a blank line, or containing a specific number of lines
- known sections: [fileset], [script], [uid], [exclude], [options]
Example configuration file:
[fileset]
Word Documents
*
C:\**HOME\
D:\Backup\**HOME\
type=Word
[fileset]
ini-Files (System)
*.ini
C:\System\
D:\Backup\System\
[script]
Cleanup
del C:\System\Temp\*
del C:\System\Wtldata\Cache.wtd
[exclude]
C:\System\Temp\*
C:\System\Wtldata\*
[uid]
taBackup=268457420
Backup Sets
- the first file set is the default one -- this is only important for script files, which are opened from the system shell.
- **HOME is expanded to your standard folder's name
- a file set definition consists of four or five lines:
1. title
2. pattern
3. source directory
4. destination directory
(5. additional options)
Example entry:
[fileset]
Standard Folder
*
C:\**HOME\
D:\Backup\**HOME\
[fileset]
ini-Files (System)
*.ini
C:\System\
D:\Backup\System\
Exclude Files
- define files or directories that should be excluded from backups in the exclude-section of your configuration file
- you may use wildcards to define excluded files
Example entry:
[exclude]
C:\System\Temp\*
C:\System\Wtldata\*
Options
The following options can be defined in the configuration file:
- www = [App name] (web) ... name of web browser
- editor = [App name] (taBackup) ... name of text editor
- escape = [on|off] (off) ... Allow exiting the program by pressing the escape-key
- questions = [text|dialog] (dialog) ... Use text or dialogs for asking questions?
- trim saved versions = [on|off] (on) ... if you change the number of "keep versions", older versions, exceeding the new setting, will be deleted. Set this option to "off" in order to avoid this behaviour.
- external = [dir\] (c:\system\taBackup\) ... The directory where taBackup finds external commands. The external command "test", for instance, refers to the procedure "test$:(arg$)" in the file "[external dir\]test.opo"
- varmarker_pre = [txt] (**); varmarker_post = [txt] () ... If you don't like the way variables are marked, you can change this with these two options. "<" and ">" could be a good alternative.
- shortcut action = [Preview|Run|Run faster|Ask] (Ask)
Example entry:
[options]
www = web
editor = taBackup
escape = on
Script Files
- There is a possibility to put scripts into their own files, which can be executed by double-clicking/tapping
- In order to create such a file, select Scripts/New File from the menu. Or choose "New file" from the system shell's menu.
- Shortcuts are a standardised scripts that are generated in a more or less convenient way
Scripts
Scripts contain a series of shell/CLI/DOS like commands. I guess there a better programs around for writing batch scripts, but this didn't keep me from doing my own stuff. Be aware of the fact that most of this is anything else but carefully tested.
- if a path contains a blank space, the file name has to be enclosed in quotes
- absolute pathnames have to be used; there is no "current working directory"
- wildcards may be used as defined in the OPL manual
- more than one command may be put into one line if separated by " : " (space-colon-space) (don't do it)
Example entry:
[script]
Example script
bak C:\Startup\ D:\Backup\Startup\
sync C:\System\ HD:PsionBackup:System: *.ini
cp "C:\Startup\Test 1" D:\Backup\Startup\Test_1
del "C:\Startup\Test 1"
if exist * del C:\config.txt
if not exist * md C:\Startup\
if days03 * del C:\config.txt
for c:\bat\* d:; c:\download\* d: \\ if days03 * cp **1 **2
set 1 1
label x
print **v01
add 1 1
if < **v01 10 goto x
[script]
test 1
for C:\OPL\* \\ call "test 2" **1
[script]
test 2
print **a1
UIDs
In your configuration file you can define UIDs, in order to determine the owner of a file. These UIDs are appended to the "File Type" menu.
Example entry:
[uid]
taBackup=268457420
Commands
- cp/copy [from] [to] ... copy
- cpv[N] ... copy and retain N versions of a file
- xcp/xcopy [from] [to] ... performs the same command as "backup" -- at the moment, this is the same as "cp". But hey, this seems to be the same as xbak ... hm
- mv/move/rename [from] [to] ... move (implemented as copy [from] [to] + delete [from])
- del/rm [path] ... delete/remove
- md/mkdir [path] ... create a new directory
- rmdir/rd [path] ... remove directory
- bak/cpic/cpin/sync/syncb/upd [from] [to] [pattern (optional)] ... backup/copy if changed/synchronise/synchronise-bi/update
- xbak/xcpic/xcpin/xsync/xupd [from] [to] ... perform equivalent action with single files; to be used in conjunction with "for", "rundir", or "if"
- rem [text] ... ignore, do not execute
- print [text] ... print a message
- run [*/app] [file] ... open or create a file with a specific application, or with the standard application ("*"), if possible
- pause [n] ... pause execution -- might be useful when running application
- call [script/fileset] [args (optional)] ... backup a fileset or run a script; a script name with blanks in it has to be enclosed in quotes; you can omit the call-command if the script doesn't have the same name as one of taBackup's commands
- rundir [command] [from] [to] [pattern] ... move down a directory tree and call [command] with one (if [to] is set to "") or two arguments. The command is called by appending [from] and [to] to the command name.
- load [file] [script (optional)] ... load a file, and execute a script, or the first one if none is specified. These files have to be located in the external's directory, defined in the "Options" section.
- label [text] ... define a label; the rest of the line is taken as the label's definition; the label text should not contain blanks, " ace;: ace;", "=", or "**"
- goto [text] ... jump back to a previously defined label
- run, runfaster, ask ... switch the way commands are processed
- mode [Backup, Update ...] ... change the backup mode. The names have to written exactly as shown in the main dialog.
- opl [cmd] [arg ...] ... Call an external command, i.e. opl procedure. The external command name "test", for instance, refers to the procedure "test$:(arg$)" in the file "[external dir\]test.opo". This procedure can be called by "opl test arg1 arg2 ...". The arguments are concatenated to one string. Thus, in this example, test$: would be called with the argument "arg1 arg2".
- oplf [slot number] [cmd] [arg ...] ... Does the same as "opl", but the return value of the external procedure is stored in a slot.
Commands to manipulate slots
- set/set$ [slot] [arg] ... if you put a string into a slot, the numeric value of this slot equals to the string's length; this command can also be used to change the backup mode, the action mode, or the number of versions kept ("mode", "action", or "keepversions") from within a script; if you use "set$" these special variables take as argument the names shown in the dialogs; if you use "set", the corresponding number is used
- add/add$ [slot] [arg] ... if you add 1 to "abc", you get 4; if you had used add$, you would have got "abc1"; if you add 0 to "abc1", you get 4
- eval [slot] ... evaluate the textual representation of a slot
FOR
- for [arg11 arg12 ...; arg21 arg22 ...] \\ [cmd **1 **2] ... execute a command for a list of arguments; the first arg may contain wildcards; **N is expanded to the Nth argument in the list; actually, these placeholders are converted to argument slot markers -- see below; up to nine arguments are allowed
IF
- if (not) [test] [*/testarg1 ...] [cmd] [arg1 ...] ... conditional execution of a command; if the test argument is '*', the first argument of the subsequent command will be used instead
known tests:
- exist [path] ... check if a file/dir exists,
- daysNN [path] ... check if a file is older than NN days
- kbNNN [path] ... check if a file is bigger that NNN kilobytes (defined as 1000 bytes, which is not 100% correct)
- is[TYPE] [path] ... checks if a file is of a specific type: Dir, File, Readonly, Hidden, System, Word, Agenda, Data, Program, TextEd, OPL; your own file types can be defined in the uid-section of the configuration file
- =, <, > [NNN] [NNN] ... compare two numbers; in conjunction with label/goto, this can be used to define loops
Slots
A slot or register is a rather simple mechanism to store data for later retrieval. All slots are global.
- there are up to 20 data slots available; a slot is addressed by **vNN
- slots can be used to pass values to scripts; this is done with the call-command -- see test1 and test2 below; up to nine arguments are allowed; arguments are addressed by **aN
- six additional slots contain information about the last source file and the last destination file processed, i.e. copied, moved or deleted:
Sourcefile/dir/path: **sf, **sd, **sp
Destinationfile/dir/path: **df, **dd, **dp
- some of taBackup's variables can be addressed as slots:
**mode ... nth backup mode
**mode$ ... Name of a backup mode
**action ... nth action mode
**action$ ... Name of a action
**keepversions ... Number of versions to be kept
**loglevel ... Log level
- if you don't want a slot name to be expanded, insert "**pass:[slot]"; this will be expanded to "**[slot]"
Example entry:
[script]
test 1
set$ 1 abc
add 1 1
print **v01 = 4
set$ 1 abc
add$ 1 1
print **v01 = abc1
add 1 0
print v01: **v01 = 4
set 1 1+2
print v01: **v01 = 3
add 1 1+2
print v01: **v01 = 6
set 2 **v01 + 2
print v02: **v02 = 8
set$ 2 **v01 + 2
print v02: **v02 = 6 + 2
eval 2
print v02: **v02 = 8
for C:\OPL\* \\ call "test 2" **1
[script]
test 2
print **a1
The outer space
When speaking about connections from taBackup to the outer world, I refer to the possibility of (1) calling OPL-procedures from within a taBackup script, and of (2) calling taBackup from some other program. The first one is achieved using the "OPL" or the "OPLF" command. The second can be made easier by using command line switches. In a command line perspective, the syntax for calling taBackup is:
taBackup [path to a taBackup file|option ...]
where "option" is one of the following:
- /call=[script|file set]
- /cmd=[valid taBackup command]
If the argument contains a slash ("/"), the whole argument has to be enclosed in single quotes. If the argument contains a slash and a single single quote, you're out of luck. From within a OPL program taBackup can be called by adapting the following example:
include "system.oxh"
proc test:
runapp&:("OPL", "/call=Test /cmd='print /0' /cmd=pause 0", "Rc:\System\Apps\taBackup\taBackup.app", 0)
endp
DOS, Mac, Unix
The program is aware of different file naming conventions. At the moment, this feature is totally (100%) useless. Nevertheless, possible future uses would be: making a backup to a Mac or Unix computer, to a ftp server etc. EpocSync already does synchronisation via ftp. Thus, I don't think that I will implement this feature.
Example entry:
[fileset]
Backup to Mac
*
C:\Dokumente\
HD:PsionBackup:Dokumente:
[fileset]
Backup to Unix
*
C:\Dokumente\
~/PsionBackup/Dokumente/
Future Plans
Known Problems, Limitations, and Unexpected Behaviour
- There are some incompatibilities between Epoc32 and Windows in the handling of CF-disks. As a consequence, the file names of some files saved under Epoc32 appear truncated to 8+3 chars under Win98.
- If you use your CF-disk with the emulator, different time settings could confuse taBackup when synchronising files. If you don't take care, you could possibly overwrite a file you edited on one machine with an older version previously being edited on another computer.
- Tip:
- Choose "Keep older versions" when synchronising files being edited on different computers. This doesn't make the program copy the right version, but at least the newer version won't be deleted.
- Tip:
- Choose "Cross-checking".
- The whole archive/backup has to fit onto one disk.
- In some dialogs the keyboard shortcuts are not explicitly named. Press the ctrl key plus the letter in capitals. E.g. "nOne" means pressing ctrl + o. A label with all letters in capitals means 'Enter'. "Cancel" or "Escape" means just that.
- Script lines have to be less then 255 characters long.
- The number of characters in the names of all file set names (excl. scripts) should not exceed 255 minus the number of file sets.
- The method used for date comparison doesn't work for comparing file dates before and after the year 2037.
Version History
- 1.02 edit shortcuts; crosschecks; options section; external commands; "rundir"; bug fixes
- 1.01 Several internal changes; images (partial catalogs); version control now works;
- 1.0 "if kbNNN"; "if isdir"; slots; check for file types; catalog; label/goto; version control
- 1.0b1 call; logfile
- 1.0b first public release